package cc.lj.internal.merchant.infrastructure.repository.mysql;

import cc.lj.internal.core.exception.ServiceException;
import cc.lj.internal.core.model.BasePageHelper;
import cc.lj.internal.merchant.domain.brand.repository.IMerchantBrandRepository;
import cc.lj.internal.merchant.infrastructure.dao.IMerchantBrandMapper;
import cc.lj.internal.merchant.infrastructure.exception.MerchantExceptionEnum;
import cc.lj.internal.merchant.infrastructure.po.MerchantBrandPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商户品牌表　Mysql仓储实现
 * @author liangxifeng
 * @date 2021-12-24
 */
@Slf4j
@Service(value = "merchantBrandMysqlRespository")
public class MerchantBrandMysqlRespository implements IMerchantBrandRepository, BasePageHelper<MerchantBrandPO> {
    @Autowired
    private IMerchantBrandMapper brandMapper;
    @Override
    public List<MerchantBrandPO> list(MerchantBrandPO param) {
        return null;
    }

    @Override
    public MerchantBrandPO getById(Integer id) {
        MerchantBrandPO brandPO = brandMapper.selectById(id);
        if(brandPO == null) {
            throw new ServiceException(MerchantExceptionEnum.MERCHAND_BRAND_GETONE_IS_NULL);
        }
        return brandPO;
    }
}
